package ua.kharkov.knure.pereverziev.diploma.web.util;

import java.io.InputStream;

import javax.servlet.ServletContext;

import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;

public class ReportUtil {
	public void compileReports(ServletContext servletContext) {
		JasperReport jasperReport;
		JasperPrint jasperPrint;
		try {

			InputStream is = getClass().getResourceAsStream("/report.jrxml");
			jasperReport = JasperCompileManager.compileReport(is);
			servletContext.setAttribute("report", jasperReport);
		} catch (JRException e) {
			e.printStackTrace();
		}
	}
}